package info.ask4research.model.addons;

import info.ask4research.model.enums.QuestionsDefine;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;

import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;


@Entity
@DiscriminatorValue("QUESTIONSANDANSWERS")
@JsonAutoDetect
public class QuestionsAndAnswers extends Addon implements Addons{

	/**
	 * 
	 */
	private static final long serialVersionUID = 6393946662500542747L;
	@Column(name="QuestionsDefine")
	private QuestionsDefine questionsDefine ;
	@Column(name="minimum")
	private Integer minimum;
	@Column(name="maximum")
	private Integer maximum;
	
	@Column(name="numberOfQuestions")
	private int numberOfQuestions;
	@LazyCollection(LazyCollectionOption.FALSE)
	@OneToMany
	@JoinColumn(name="QuestionsAndAnswers_ID", referencedColumnName="addon_ID", nullable=true)
	private List<Question> questions = new ArrayList<Question>();
	public int getNumberOfQuestions() {
		return numberOfQuestions;
	}
	public void setNumberOfQuestions(int numberOfQuestions) {
		this.numberOfQuestions = numberOfQuestions;
	}

	public List<Question> getQuestions() {
		return questions;
	}
	public void setQuestions(List<Question> questions) {
		this.questions = questions;
	}
	public Integer getMinimum() {
		return minimum;
	}
	public void setMinimum(Integer minimum) {
		this.minimum = minimum;
	}
	public Integer getMaximum() {
		return maximum;
	}
	public void setMaximum(Integer maximum) {
		this.maximum = maximum;
	}
	public QuestionsDefine getQuestionsDefine() {
		return questionsDefine;
	}
	public void setQuestionsDefine(QuestionsDefine questionsDefine) {
		this.questionsDefine = questionsDefine;
	}
}
